<template>
  <div class="fl-utils-panel">
    <div class="fl-utils-btn" title="放大" @click="zoomIn">
      <i class="el-icon-plus"></i>
    </div>
    <div class="fl-utils-btn" title="缩小" @click="zoomOut">
      <i class="el-icon-minus"></i>
    </div>
    <div class="fl-utils-btn" title="重置" @click="zoomReset">
      <i class="el-icon-rank"></i>
    </div>
    <div class="fl-utils-btn" title="下载图片" @click="downloadImage">
      <i class="el-icon-picture-outline"></i>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    lf: Object,
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    downloadImage() {
      this.lf.getSnapshot()
    },

    zoomIn() {
      this.lf.zoom(true)
    },

    zoomOut() {
      this.lf.zoom(false)
    },

    zoomReset() {
      this.lf.resetZoom()
    },
  },
}
</script>

<style lang="scss" scoped>
.fl-utils-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.25rem;
  display: flex;
  background-color: hsla(0, 0%, 100%, 0.7);
  border: 1px solid #eee;
  border-radius: 22px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  opacity: 0.5;
  transition: opacity 0.3s;

  &:hover {
    opacity: 1;
  }

  .fl-utils-btn {
    cursor: pointer;
    font-size: 1.25rem;
    transition: color 0.3s;
    height: 35px;
    width: 35px;
    line-height: 35px;
    text-align: center;
    overflow: hidden;
    &:hover {
      color: $primary;
      color: var(--primary);
    }
  }
}
</style>
